use image::{ImageBuffer, Rgba};
use std::f64::consts::PI;

pub fn create_mobius_icon(size: u32) -> ImageBuffer<Rgba<u8>, Vec<u8>> {
    let mut img = ImageBuffer::new(size, size);
    let center_x = size as f64 / 2.0;
    let center_y = size as f64 / 2.0;
    let radius = size as f64 * 0.4;
    
    // 绘制莫比乌斯环
    for t in 0..360 {
        let angle = (t as f64) * PI / 180.0;
        let _width = size as f64 * 0.1;
        
        // 参数方程
        for s in -100..100 {
            let s = (s as f64) / 100.0;
            
            let x = center_x + radius * (angle.cos() + s * angle.cos() * 0.5);
            let y = center_y + radius * (angle.sin() + s * angle.sin() * 0.5);
            
            // 确保坐标在图像范围内
            if x >= 0.0 && x < size as f64 && y >= 0.0 && y < size as f64 {
                let color = Rgba([0, 120, 215, 255]); // Windows蓝色
                img.put_pixel(x as u32, y as u32, color);
            }
        }
    }
    
    img
}